package com.rule.dsl.resolver.resolver.impl;

import com.rule.dsl.resolver.DSLResolver;
import org.springframework.stereotype.Component;
/**
 * 。
 * BankResolver 用于获取当前利率和目标完成与否的信息。 这里的解析器关键字是 bank ，
 * 子关键字是 interest 和 target_done
 */
@Component
public class BankResolver implements DSLResolver {
    //银行领域关键字
    private static final String RESOLVER_KEYWORD = "bank";
    //利息 子关键字
    private static final String INTEREST = "interest";

    //贷款目标是否完成 子关键字
    private static final String TARGET_DONE = "target_done";

    @Override
    public String getResolverKeyword() {
        return RESOLVER_KEYWORD;
    }

    @Override
    public Object resolveValue(String keyword) {
        //关键字是否匹配利息子关键字
        if (keyword.equalsIgnoreCase(INTEREST)){
            //Code to calculate the current variable interest rates.
            return 9.0;
        }
         //关键字是否匹配贷款目标是否完成关键字
        if (keyword.equalsIgnoreCase(TARGET_DONE)){
            //Code to see the bank target of giving loan for this current year is done or not.
            return false;
        }

        return null;
    }
}
